<?php 
$availablePublications=$Course->getAvailablessPublicationsToInscription();
$qtyPublications=count($availablePublications);
$currentPublication=null;
$othersPublications=array();
if($qtyPublications>0){
$currentPublication= $availablePublications[0];
}
for($i=1; $i<=$qtyPublications; $i++){
    array_push($othersPublications, $availablePublications[$i]);
}


?>
<?php include_partial("global/navigation")?>
<div class="margin-page">
<h2><?php echo $Course->getName(); ?></h2>
<p>
    <?php echo $Course->getDescription(); ?>
</p>

<?php
$fields=CourseTable::$DinamicFieldsDescription;
foreach ($fields as $name=>$val){
    $description=$Course->getRawValue()->__get($name);
    if(!$description) continue;
    ?>
    <br class="both" />
    <div class="container-curse-info">
        <h3><?php echo $val["descr"] ?></h3>
        <p><?php echo $description; ?></p>
    </div>
    <?php
}
?>
    <?php 
    $Teachers=array();
    if($currentPublication){
        $Teachers=$currentPublication->getTeachers();
    }
    ?>
    <div class="fright">
        <h3>Profesores que lo Imparten</h3>
        <ul class="teacher-list">
            <?php 
            $numTeacher=0;
            foreach($Teachers as $Teacher) {
                $numTeacher++;
            ?>
                <li>
                    <div>
                        <div class="photo">
                            <img src="<?php echo $Teacher->getThumbnail() ?>" /> 
                        </div>
                        <div class="name"><?php echo $Teacher->getFirstName()." ".$Teacher->getLastName(); ?></div>
                    </div>
                </li>
            <?php 
            if($numTeacher>=2){
                break;
            }
            } ?>
        </ul>
            
    </div>
    
<br class="both" />
</div>
<hr />

<?php 


$CurrentPrices=array();
if($currentPublication){
 $CurrentPrices= $currentPublication->getAvailablePrices();
}
 
if(count($CurrentPrices)>0){?>
<div class="margin-page mbottom">
    <h3>Precio del Curso</h3>
    <ul>
        <?php foreach($CurrentPrices as $key=>$PublicationPrice) {?>
        <li><?php echo $PublicationPrice->getDescription(); ?> BsF. <?php echo $PublicationPrice->getTotalPrice(); ?></li>
        <?php } ?>
    </ul>
    <div><a class="shop-main" href="<?php echo url_for("@generate_token?publication_id={$currentPublication->getId()}&course_slug={$Course->getSlug()}") ?>"><?php echo __("Comprar Curso") ?></a></div>
</div>
<?php } ?>

<?php if(count($othersPublications)>0){ ?>
<ul>
    <?php foreach($othersPublications as $key=>$otherPubli) { ?>
    <li>
        <?php echo $otherPubli ?>
    </li>
    <?php } ?>
</ul>
<?php } ?>


<div class="margin-page mbottom">
    <h3><?php echo $PaimentType->getRawValue()->getTitle()?></h3>
    <p>
        <?php echo $PaimentType->getRawValue()->getInfo()?>
    </p>
</div>